var app = {

    baseUrl: 'http://homestead.test',

    init: function() {
        if (location.href.indexOf('www.wfscale') >= 0) {
            app.baseUrl = 'http://www.wfscale.com'
        } else if (location.href.indexOf('wfscale') >= 0) {
            app.baseUrl = 'http://wfscale.com'
        }
    },

    getSelectUid: function() {
      return $('#user-id').val();
    },

    getStatusCode: function() {
      return $('#status-code').val();
    },

    users: function() {
        $.ajax({
            url: app.baseUrl + '/users',
            type: 'GET',
            data: {
                code: app.getStatusCode()
            },
            success: function(data) {

            }
        })
    },

    delete: function() {
        var uid = app.getSelectUid();
        $.ajax({
            url: app.baseUrl + '/users/' + uid,
            type: 'DELETE',
            data: {
                id: 1,
                code: app.getStatusCode()
            }
        })
    },

    update: function() {
        var uid = app.getSelectUid();
        $.ajax({
            url: app.baseUrl + '/users/' + uid,
            type: 'PATCH',
            data: {
                name: '我是修改后的：张' + uid,
                code: app.getStatusCode()
            }
        })
    },

    new: function() {
        $.ajax({
            url: app.baseUrl + '/users',
            type: 'POST',
            data: {
                id: '',
                name: '',
                code: app.getStatusCode()
            }
        })
    }
};

app.init();